package com.mdroid.app.plugin

import com.mdroid.app.plugin.webview.FlutterCookieManager
import com.mdroid.app.plugin.webview.WebViewFactory
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.PluginRegistry.Registrar

class AppPlugin {
  companion object {
    /** Plugin registration. */
    @JvmStatic
    fun registerWith(registrar: Registrar) {
      MethodChannel(registrar.messenger(), "app.plugins.flutter.io/plugin").apply {
        setMethodCallHandler(PluginMethodCallHandler())
      }

      registrar
        .platformViewRegistry()
        .registerViewFactory(
          "plugins.flutter.io/webview", WebViewFactory(registrar.messenger())
        )
      FlutterCookieManager.registerWith(registrar.messenger())
    }
  }

}
